var $id = document.getElementById("checked11");
var button = document.getElementById("submit");


button.onclick = function() {
    if ($id.checked === false) {
        alert("请勾选认证协议")
        return false
    }
}





$(".button").click(function() {
    if ($id.checked === true) {
        var fff = $("#fff").val()
        var fff2 = $("#fff2").val()
        var name33 = $("#name33").val()
        var data33 = $("#data33").val()
        var phone33 = $("#phone33").val()
        var jiguan33 = $("#jiguan33").val()
        var youxiang33 = $("#youxiang33").val()
        var sex = $("input[name='sex']:checked").val();


        var file = $("#zhaopian_url").val()
            //资质
        var chooseUrl = $("#chooseUrl").val()
            // 征信
        var chooseUrl1 = $("#chooseUrl1").val()
            //体检
        var chooseUrl2 = $("#chooseUrl2").val()
            //文本域
        var texta = $("#texta").val()
        console.log(name33, data33, phone33, jiguan33, youxiang33, sex);
        console.log(file);
        console.log(chooseUrl);
        console.log(chooseUrl1);
        console.log(chooseUrl2);
        console.log(texta);
        console.log(fff);
        console.log(fff2);
        $.ajax({
            url: 'http://192.168.8.109/api/login/consultant',
            type: 'post',
            data: {
                cons_ida: fff,
                cons_idb: fff2,
                nickname: name33,
                birth: data33,
                place: jiguan33,
                phone: phone33,
                sex: sex,
                mail: youxiang33,
                head_pic: file,
                voucher: chooseUrl,
                credit: chooseUrl1,
                inspect: chooseUrl2,
                introduce: texta
            },
            success: function(res) {
                console.log(res);
                var status = JSON.parse(res).status
                showTips(JSON.parse(res).msg, 700, 3);

                function showTips(content, height, time) {
                    //窗口的宽度  
                    // var windowWidth = $(window).width();
                    var tipsDiv = '<div class="tipsClass">' + content + '</div>';

                    $('body').append(tipsDiv);
                    $('div.tipsClass').css({
                        'position': 'absolute',
                        'top': 150 + '%',
                        'left': 50 + '%',
                        'padding': '3px 5px',
                        'background': 'rgba(51, 51, 51, 0.4)',
                        'font-size': 18 + 'px',
                        'margin-left': -50 + 'px',
                        'border-radius': 10 + 'px',
                        'margin-top': -25 + 'px',
                        'line-height': '50px',
                        'text-align': 'center',
                        'width': 'auto',
                        'height': '50px',
                        'color': '#fff',
                        'opacity': '1'
                    }).show();
                    clearTimeout(settimer)
                    var settimer = setTimeout(function() { $('div.tipsClass').remove(); }, (time * 500));
                    content = ''
                    if (status === 1) {
                        setTimeout(function() {
                            window.location = 'companyLogin.html'
                        }, 2000)
                    }
                }
            },


        })

    }

});